package chapter01

class Student(name: String, var age: Int){
  def printerInfo(): Unit = {
    println(name + " " + age + " " + Student.school )
  }
}
//引入伴生对象
//把全局只有一份的直接放在伴生对象里面
object Student{
  val school: String = "hypers"

  def main(args: Array[String]): Unit = {
    val bob = new Student("bob" , 20)
    val alice = new Student("alice" , 25)

    alice.printerInfo()
    bob.printerInfo()
  }
}